import { CustomSession, CaptchaResponse } from '../../types/auth';

export function verifyCaptcha(session: CustomSession, captchaInput: string): CaptchaResponse {
    if (!session.captcha) {
        return {
            success: false,
            message: '验证码已过期',
            error: '验证码已过期'
        };
    }

    if (captchaInput.toLowerCase() === session.captcha.toLowerCase()) {
        session.captcha = undefined;
        return {
            success: true,
            message: '验证码正确'
        };
    }

    return {
        success: false,
        message: '验证码错误',
        error: '验证码错误'
    };
} 